asPNG

Undocumented in source. Be warned that the author may not have intended to support it.
  1. managed!(PNGFileFormat!Color) asPNG(From from, IAllocator allocator)
  2. managed!(PNGFileFormat!Color) asPNG(From from, IAllocator allocator)
    @safe
    managed!(PNGFileFormat!Color)
    asPNG
    (
    From
    Color = ImageColor!From
    ImageImpl = ImageStorageHorizontal!Color
    )
    (
    ref From from
    ,
    IAllocator allocator = theAllocator()
    )
    if (
    isImage!From &&
    is(From == struct)
    )

Examples

    import std.experimental.color;
    import std.conv : hexString;
    
    import std.file : read;
	auto input = cast(ubyte[])"89504E470D0A1A0A0000000D4948445200000002000000020802000000FDD49A73000000097048597300000B1300000B1301009A9C180000000774494D4507DF07150E122E54E72FF10000001974455874436F6D6D656E74004372656174656420776974682047494D5057810E17000000114944415408D763F8CFC0C0F09F014A000019F402FEE23BE1150000000049454E44AE426082".hexString;
	
    ImageStorageHorizontal!RGB8 image = ImageStorageHorizontal!RGB8(2, 2);
    managed!(PNGFileFormat!RGB8) image2 = asPNG(&image);
    
    // modify some fields
    
    ubyte[] or = image2.toBytes();

Meta